Skip to content

chore: Set persist-credentials false on pull-request workflows - #2003

Merged
hatayama merged 1 commit into
v3-betafrom
chore/persist-credentials-pr-workflows
Jul 25, 2026
Merged

chore: Set persist-credentials false on pull-request workflows#2003
hatayama merged 1 commit into
v3-betafrom
chore/persist-credentials-pr-workflows

Conversation

@hatayama

@hatayama hatayama commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Pull-request CI runs no longer leave GITHUB_TOKEN where code from the pull-request branch can read it.
  • A new architecture test blocks any future pull-request workflow from reintroducing the leak.

User Impact

Before: actions/checkout defaults to writing GITHUB_TOKEN into the local Git config
(http.<host>.extraheader). Every pull-request workflow that then executes repository-controlled
code — tests, linters, go run ./cmd/..., shell scripts — gave that code a readable path to the
token. dead-code.yml was hardened in #1995, but the other pull-request workflows were not.

After: no pull-request workflow persists credentials, so a malicious or compromised change on a
pull-request branch cannot read the workflow token out of Git config. Nothing else changes for
contributors — CI behaves exactly as before.

Changes

  • Set persist-credentials: false on every actions/checkout step in build-and-test.yml,
    code-complexity.yml, security-scan.yml, unity-compile-check-and-test-runner.yml, and
    pr-title.yml.
  • pr-title.yml was not listed in the issue, but it is triggered by pull_request and runs
    repository code (go run ./cmd/check-pr-title), so it meets the same condition and is fixed here.
  • None of these workflows run git push / git fetch / git tag after checkout, so nothing
    depended on the persisted token. github/codeql-action/* authenticates through the API token in
    the environment, not through Git config.
  • Add TestPullRequestWorkflowsDisableCredentialPersistence, mirroring the existing setup-go cache
    and Unity cache guards, so the rule is enforced instead of remembered.
  • Document the rule and its rationale in docs/github-actions-security.md.

Release workflows that genuinely push back to the repository are deliberately left untouched.

Verification

Written test-first: the new test initially failed with all 8 offending checkout steps listed, and
passes after the workflow changes.

cd cli/release-automation
go test ./internal/architecture -run 'TestWorkflowActions|TestPullRequestWorkflow' -count=1   # ok

scripts/check-go-cli.sh   # all modules ok, 0 lint issues

ruby -ryaml -e 'ARGV.each { |p| YAML.load_file(p) }' .github/workflows/*.yml   # 13 files parse

The workflows touched here all run on this pull request, so their green status is the end-to-end
check that nothing after checkout depends on the removed credentials.

Closes #1998

Review in cubic

actions/checkout stores GITHUB_TOKEN in the local Git config by default, so any
repository script or test a pull-request workflow runs from the PR branch can
read it. dead-code.yml already disabled credential persistence; the remaining
pull-request workflows that execute repository code did not.

- Set persist-credentials: false on every actions/checkout step in
  build-and-test, code-complexity, security-scan, pr-title, and
  unity-compile-check-and-test-runner. None of them use Git authentication
  after checkout, so nothing depends on the persisted token.
- Add TestPullRequestWorkflowsDisableCredentialPersistence so a future
  pull-request workflow cannot reintroduce the leak.
- Document the rule in docs/github-actions-security.md.

Closes #1998
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 87d7094c-2a4f-4d55-817b-4382b840654e

📥 Commits

Reviewing files that changed from the base of the PR and between ca7e0db and 4911fa4.

📒 Files selected for processing (7)
  • .github/workflows/build-and-test.yml
  • .github/workflows/code-complexity.yml
  • .github/workflows/pr-title.yml
  • .github/workflows/security-scan.yml
  • .github/workflows/unity-compile-check-and-test-runner.yml
  • cli/release-automation/internal/architecture/github_actions_security_test.go
  • docs/github-actions-security.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/persist-credentials-pr-workflows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hatayama
hatayama merged commit f3a3e75 into v3-beta Jul 25, 2026
13 checks passed
@hatayama
hatayama deleted the chore/persist-credentials-pr-workflows branch July 25, 2026 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant